package org.myframework.commons.ftp;

import org.myframework.commons.ftp.impl.*;

public class FtpConfig {
	private String host, username,   password ,ftpType;
	private int port ;

	public FtpConfig(){
		super();
	}

	public FtpConfig(String host, String username, String password,
			 int port ,String ftpType) {
		super();
		this.host = host;
		this.username = username;
		this.password = password;
		this.ftpType = ftpType;
		this.port = port;
	}

	public String getHost() {
		return host;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public String getFtpType() {
		return ftpType;
	}


	public void setFtpType(String ftpType) {
		this.ftpType =ftpType;
	}

	public CommonFtp connect() throws Exception{
		CommonFtp commonFtp ;
		if("sftp".equalsIgnoreCase(ftpType))
			 commonFtp = new SFTPClient();
		else
			 commonFtp = new FtpClient();
		commonFtp.connect(host, username,   password ,port);
		return commonFtp;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}


}
